""" 1_2 GPIO输出：呼吸灯 """
# https://learn.adafruit.com/adafruit-esp32-s3-tft-feather/blink

# board.LED 于 board.L等同

""" 呼吸灯 """
import time
import board
import pwmio
led = pwmio.PWMOut(board.LED, frequency=5000, duty_cycle=0)  # 创建pwm对象输出到LED

while True:
    for i in range(100):
        if i < 50:
            led.duty_cycle = int(i * 2 * 65535 / 100)  # 设置占空比值
        else:
            led.duty_cycle = 65535 - int((i - 50) * 2 * 65535 / 100)
        time.sleep(0.01)
